﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApplication5
{

    public static class ModelProvider
    {
        private static BaseModel basemodel;

        public static BaseModel Basemodel
        {
            get
            {
                if (basemodel == null)
                {
                    basemodel = (BaseModel)Assembly.Load("ConsoleApplication5").CreateInstance("ConsoleApplication5.TestModel");
                    //_userProvider = (IUser)new UserMgr();
                }
                return basemodel;
            }
        }
    }

    public class AVB : TestActra
    {

        public override void Gou()
        {
            this.GGG();
            throw new NotImplementedException();
        }
    }

    public abstract class TestActra
    {
        public abstract void Gou();

        public void GGG()
        {
        }

        public string name { get; set; }
    }


    class Program
    {
        static void Main(string[] args)
        {
            var b = UserProvider.MyUserProvider.GetName("bbb");

            IFly u = new Boy();
            var a = GetResult(new Boy());
            var c = GetResult(new Girl());
            var d = u.GetFly();//隐式调用

            Student stu = new Student();
            Console.WriteLine(stu.GetName("李白"));

            Console.WriteLine(stu.GetContent(stu));


            var e = (u as IUser).GetName("eee");

            Console.WriteLine(a);
            Console.WriteLine(c);
            Console.WriteLine(d);
            Console.WriteLine(e);

            //BaseModel bm;
            //string k = "test1";
            //if (k == "test")
            //{
            //    bm = new TestModel().model;
            //}
            //else
            //{
            //    bm = new ZhengShiModel().model;
            //}
            //Console.WriteLine(bm.Key);

            Console.WriteLine(ModelProvider.Basemodel.Key);

            Console.Read();
        }

        public static string GetResult(IFly f)
        {
            return f.GetFly();
        }
    }
}
